package com.xingkeduo.business.user.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.xingkeduo.business.transformation.json.CraftsmanBackJTO;
import com.xingkeduo.business.user.domain.ManageInfoDomain;
import com.xingkeduo.pojo.table.CraftsmanBackTO;
import com.xingkeduo.util.pojo.base.BaseController;
import com.xingkeduo.util.tool.ReturnUtil;

/**
 * 一线员工召回
 * 
 * @author 高杰
 * @time 2019年1月12日 下午6:38:17
 * @description
 */
@RestController
@RequestMapping("/craftsman/back")
public class CraftsmanBackController extends BaseController {
	@Autowired
	private ManageInfoDomain manageInfoDomain;

	/**
	 * 修改接口
	 * 
	 * @author 高杰
	 * @time 2019年1月12日 下午6:38:02
	 * @param url
	 * @param body
	 * @return
	 */
	@PostMapping(value = "/{url:.+}")
	public String doPut(@PathVariable String url, @RequestBody String body, ServerHttpRequest request) {
		returnUtil = new ReturnUtil();
		try {
			CraftsmanBackTO craftsmanBack = CraftsmanBackJTO.createTableForNew(body);
			manageInfoDomain.modifyCraftsmanBack(craftsmanBack, getOperator(request));
			return returnUtil.getSuccess();
		} catch (Throwable t) {
			return dealException(t, returnUtil);
		}
	}
}
